home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus Extra 1997 #2 / Amiga Plus Extra 1997 #2.iso / pd / misc / macro / scanner / classes.c next >
Encoding:
C/C++ Source or Header  |  1997-02-16  |  1.2 KB  |  52 lines

  1.  
  2.  
  3. /*
  4. **  ***********************************************************************
  5. **
  6. **  ScanHandlerClass (c) by Stefan Schor
  7. **
  8. **  ***********************************************************************
  9. */
  10.  
  11.  
  12. #include <exec/types.h>
  13.  
  14. #define UPPER(a) ((a) & 95)
  15.  
  16. __asm
  17. ULONG
  18. ScanHandlerClass(register __d0 ULONG len, register __a0 char **text)
  19. {
  20.     const char *version = "$VER: Class 1.0 (24.3.94)";
  21.  
  22.     if (len > 6)
  23.     {
  24.         char *pos  = *text;
  25.         char *last = *text + len -1;
  26.  
  27.         if (    *pos++ == 'c'
  28.              && *pos++ == 'l'
  29.              && *pos++ == 'a'
  30.              && *pos++ == 's'
  31.              && *pos++ == 's'
  32.              && *pos   == ' ' )
  33.         {
  34.             while (pos < last && *++pos == ' ');                /* Alle Spaces übergehen  */
  35.  
  36.             *text = pos;                                        /* Hier beginnt der Text  */
  37.  
  38.             while (pos < last && *++pos != ' ');                /* Bis zum nächsten Space */
  39.  
  40.             if (*pos == ' ')
  41.                 return ((ULONG)pos - (ULONG)*text);             /* Länge zurück              */
  42.             else
  43.                 return ((ULONG)pos - (ULONG)*text + 1);         /* Länge zurück              */
  44.  
  45.         }
  46.     }
  47.  
  48.  
  49.  
  50.     return 0;
  51. }
  52.